import tkinter as tk
from views import CreateFrame,SearchFromFrame,SearchEngineFrame,SearchHeaderIdFrame,DeleteFrame,ChangeFrame,InsertFrameA,InsertFrameB,AboutFrame,RegisterFrameA,DeleteFrameA,ManageFrameA,ConfigFrameA,AuditFrameA,SETTINGFrame

class MainPage:
    def __init__(self,master:tk.Tk):
        self.root=master
        self.root.title(f'志愿者服务管理平台 ')
        self.root.geometry('800x800')
        self.root.resizable(0, 0)
        self.CreatePage()
    def CreatePage(self):
        self.create_frame = CreateFrame(self.root)
        self.delete_frame = DeleteFrame(self.root)
        self.change_frame = ChangeFrame(self.root)
        self.insert_frameA = InsertFrameA(self.root)
        self.insert_frameB = InsertFrameB(self.root)
        self.about_frame = AboutFrame(self.root)
        self.search_frameF = SearchFromFrame(self.root)
        self.search_frameE = SearchEngineFrame(self.root)
        self.search_frameH = SearchHeaderIdFrame(self.root)


        self.adminReg_frame = RegisterFrameA(self.root)
        self.adminDel_frame = DeleteFrameA(self.root)
        self.adminMag_frame = ManageFrameA(self.root)
        self.adminCIG_frame = ConfigFrameA(self.root)
        self.adminADT_frame = AuditFrameA(self.root)
        self.adminSET_frame = SETTINGFrame(self.root)




        menubar = tk.Menu(self.root)
        adminMenu = tk.Menu(menubar, tearoff=0)
        SearchMenu = tk.Menu(menubar,tearoff=0)
        ChangeMenu = tk.Menu(menubar,tearoff=0)
        adminMenu.add_command(label='新管理员注册',command=self.show_Register)
        adminMenu.add_command(label='旧管理员除名',command=self.show_AdminDelete)
        adminMenu.add_command(label='管理管理员',command=self.show_Manage)
        adminMenu.add_command(label='管理员权限设置',command=self.show_Config)
        adminMenu.add_command(label='内容审核',command=self.show_Audit)
        adminMenu.add_command(label='设置',command=self.show_Setting)
        menubar.add_cascade(label='管理员', menu=adminMenu)
        menubar.add_command(label='创建',command=self.show_Create)
        menubar.add_cascade(label='查询',menu=SearchMenu)
        SearchMenu.add_command(label='搜索数据',command=self.show_SearchE)
        SearchMenu.add_command(label='查询数据',command=self.show_SearchF)
        SearchMenu.add_command(label='编号数据',command=self.show_SearchH)
        menubar.add_command(label='删除',command=self.show_Delete)
        menubar.add_cascade(label='插入/修改',menu=ChangeMenu)
        ChangeMenu.add_command(label='修改志愿者信息',command=self.show_Change)
        ChangeMenu.add_command(label='插入旧版CSV数据',command=self.show_InsertA)
        ChangeMenu.add_command(label='新建表头编号并插入',command=self.show_InsertB)


        menubar.add_command(label='关于',command=self.show_About)
        menubar.add_command(label='退出',command=self.close)
        self.root['menu'] =menubar
    def show_Create(self):
        self.create_frame.pack()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()  
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_SearchF(self):
        
        self.create_frame.pack_forget()
        self.search_frameF.pack()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_SearchE(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_SearchH(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_Change(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_InsertA(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_InsertB(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_Delete(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_About(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_Register(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_AdminDelete(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_Manage(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_Config(self):

        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack_forget()
    def show_Audit(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack()
        self.adminSET_frame.pack_forget()
    def show_Setting(self):
        self.create_frame.pack_forget()
        self.search_frameF.pack_forget()
        self.search_frameE.pack_forget()
        self.search_frameH.pack_forget()
        self.delete_frame.pack_forget()
        self.change_frame.pack_forget()
        self.insert_frameA.pack_forget()
        self.insert_frameB.pack_forget()
        self.about_frame.pack_forget()
        self.adminReg_frame.pack_forget() 
        self.adminDel_frame.pack_forget() 
        self.adminMag_frame.pack_forget()
        self.adminCIG_frame.pack_forget()
        self.adminADT_frame.pack_forget()
        self.adminSET_frame.pack()
    def close(self):
            if tk.messagebox.askokcancel("退出", "你确定要退出吗?"):
                root.destroy()

if __name__ =='__main__':
    root =tk.Tk()
    MainPage(master=root)
    root.mainloop()